-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: enhanced Terminal Error Handling and Alert System #797
feat: enhanced Terminal Error Handling and Alert System #797
Conversation
Looks good, wanted something like this |
May be add to readme that it was done too |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thecodacus first off: That's a great PR! Thanks for preparing / documenting this so extensively!
I don't only want to look at the (very helpful) video and respond "lgtm", but it will take some time as the diff is huge.
At first glance, there are a couple of aspects I want to clarify / where I'm in doubt hoping this helps:
As you nicely introduced, there are different aspects covered in this PR and I wonder whether these separate capabilities should be combined in the way that I currently understand:
ActionAlert
You called it ActionAlert
and not ActionError
. What's the resoning behind that? I saw you also have type: 'error' | 'info';
, but I cannot think about where type: info
should be used / how the workflow handling information messages should actually be. Why not limit this to ActionError
?
If it was an ActionError
, I think about whether there could be other errors that could be resolved in a similar way (throwing an Error
which allows the LLM to try to fix it). If this was the case, then this would be something like an ActionableError
which I'd love to see. I can e. g. imagine that exceeding a context length for an LLM might be such an actionable error, with the resulting action that the workbench reduces the context.
Alerting
You are also introducing Alerting
as a component for the first time. Currently, we do have a couple of places in which we propagate information about something that didn't work as expected to the user. And we don't have this in a central place. Would it make sense to have an AlertManagement
component which provides state for all messages towards the user (and not have it in the workbench-state)?
From such a state (which holds an array of alerts then), ActionableErrors
could be propagated to the Chat.
I'm a bit reluctant to think about introducing this here, as it might be over-engineering, but I feel that introducing error handling all over the place is... not the smartest idea with respect to regression / testability.
Tests
Speaking of tests: I'd love to have automated tests for that. It would alo make sense to have real unit-tests for that (e. g. that an ActionAlert
is properly bubbled, rendered, resolved), but also an integration test would be helpful.
But frankly: If we are in a sort-of archaic mode now, I'm also fine to just merge it 😬
I wanted the alert component to have option to add other types of alerts for future usecases like if you see the commercial bolt, llm can suggest some solutions sometimes which are just suggestions from llm and use can either take that or reject. so I didn;t wanted to make the alert limited to only error and be a generic system
I have added a central place for this in workbenchStore (as this component is already holding all the other stores) but yes if the implementation becomes complex and we have lots of other alerts and stuff I do think pulling it out to make its own component is best option
Yes I like this idea of |
got it, will try to change that to something else.
got it, so the this is an issue of capturing exit code of previous commands, which we where discussing in on other PR.
yes I am not very good at writing lines 😅 , I will update the wording.
I saw how bolt.new alerts user for error. so this UX immediately came to my mind, I am up for a better UX 👍 |
Yes, that's what I guessed you wanted to achieve. However, I think that a suggestion is different compared to surfacing an error. And might be presented differently. And there may be multiple at the same time. => would you be fine to limit this PR to |
@wonderwhy-er yes makes sense. can you provide me the chat export for me to do some testing on that?
@mrsimpson sure I will just update the chat alert component and the interface |
And can't reproduce so nevermind. And current state of reloads makes me wonder if we can when loading chat wait to run commands till end end, each one once, instead of rebuilding multiple times. Something to test. |
And on reload I do get error messages again for things that were already fixed in later messages. |
yeah. was thinking about that, figuring out a way to fix that |
We might have to think of ways how to capture any error in the browser console and feed it back. There will be always errors. |
yes That will need some brainstorming, I have added that in the PR description as future improvements |
When the error logs from the browser console are copy pasted into the llm 99% of all errors get resolved and the preview works again. I spent around 3 days to log these errors from the browsers console but was unable to. Once we get these errors into our event logs we can feed the error into the Chat LLM and it heals the errors. We have to collect all errors from Terminal and from Browser console. We will feed that back to the llm and 100% will get solved and we are not stuck with a blank preview or stopped file creation. The most challenging part is getting the browser consoles logs. Any ideas? I tried nearly everything. |
Lets explore that in separate PR. |
Yes absolutely we can discuss that in a different PR. It is not just JavaScript errors but we have to collect, group and feed the Browser Console Errors into the LLM. These are connection errors, JavaScript errors, broken code errors, any error basically. The challenge is how do we get it exactly as shown in Browser console. Please create a PR and lets continue there. Thanks |
@wonderwhy-er let me know so we can advance on these errors. I guess this is a core blocker for bolt diy as I get this quite often. Maybe we get that fixed in a couple days if we put the brains together |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worked great on windows 11,
Here checked how to get errors |
Iam figuring out how to not alert when reloading once done we can merge both |
I think only way to do it is to connect errors to messsges. Considering that those errors are from commands in messages. This also kinda connects to previous discussions of snapshots. May be we should not run all terminal commands on reload. |
that might works but for that also we need a flag to know that these are coming from reloaded messages. and if thats the case I can directly use that flag to not throw any error. the problem is to how to set that flag correctly
i can try updating that PR to adapt the file load and detect package.json and add the npm commands that we are ding for git imports, might solves this issue, and will save lot of tokens that were used to rewrite the same file multiple times. |
I not fully understand this part: And it also feels like overkill for this PR, I would do it in separate one. In this one I would connect errors to messages. Sadly have busy day, may be will have time to look at it tomorrow. |
what i meant is, this PR is taking snapshot and using that snapshot on reload, that automatically saves lot of tokens as the previous chat history is not loaded and sent to the subsequent llm calls i just neeto to modify it to also run the |
ah, you are trying to many things at once again, like killing 5 birds with one stone :D You mixed "reload" and "context management" I want previous chat history available for future calls, may be no files, but text requests and responses I do. |
Just for example, this is how bolt.new messages look today: They contain full conversation including files, and excluding files will make tokens smaller but it will also make model more confused about what its doing. We can add what you propose as experimental mode that can be switched off and on to compare how well model performs. |
But also, it feels like feature from this PR should work irrespective from snapshots and and context management being implemented and used or not. |
yes context management definitely, dont need that. shapshot would have been great and it would have worked without any of these challenges.. let me see how can I set a reloading flag. |
@wonderwhy-er done, please check |
Something still feels weird about this Here have a chat that fails still But it has issue I was trying to reproduce where AI genreated code in '''json''' markdow code block style |
saw the chat.. but this is the llm fails to resolve the issue even though it understood the issue and pointed it out correctly. |
are you talking about incase of multiple errors, in this case install failed and start also failed?.. I have added the scope to only show alert for the latest error. but we can queue the errors if you like. but still think one latest error alert is good enough |
Lets not overcomlicate and jump 10 steps. First lets fix it how it is. If it works me make the next enhancement. Lets go step by step. Next step would be like windsurf running terminal in chat stream and fixing it directly. |
Good point of bolt already working like that. Tested, approved and merged |
Well done @wonderwhy-er |
Let's push the webcontainers errors as well. Will try to contribute and test |
Enhanced Terminal Error Handling and Alert System
Overview
This PR introduces a comprehensive error handling system for terminal operations, featuring user-friendly error alerts and automatic LLM-powered error resolution. The system gracefully manages command execution lifecycles, including proper abortion of superseded commands.
Key Changes
1. Terminal Error Management
ActionCommandError
class for structured error handling2. Command Execution Improvements
3. UI Enhancements
ChatAlert
component for displaying terminal errors4. Error Resolution System
Technical Details
Error Handling System
Command Lifecycle Management
Alert System Integration
Testing Considerations
Migration Notes
Future Improvements
Preview
terminal.error.capture.demo.mov
Updates
updated the UX of the Alert